
#ifndef _ANIMATION2D_H_
#define _ANIMATION2D_H_

#include <string>
#include "LibraryFrameworkExport.h"
//#include "Utilities\EventHandler.h"
#include "Animation2DTypes.h"
#include "Frame2D.h"
#include <vector>

namespace CasaEngine
{
	/////////////////////////////////////////////////////////////
	/// Sprite
	/////////////////////////////////////////////////////////////
	class LIBRARY_FRAMEWORK_EXPORT Animation2D
	{
	public:
		Animation2D();
		Animation2D(const Animation2D& rsh);
		const Animation2D& operator = (const Animation2D& rsh);
		~Animation2D();

		//EventHandler<Animation2DFrameChangedEventArgs> OnFrameChanged;
		//EventHandler OnEndAnimationReached;

		std::string Name() const;
		unsigned int ID() const;
		Animation2DType::TAnimation2DType Animation2DType() const;
		float TotalTime() const;
		float CurrentTime() const;
		int CurrentFrame() const;

	private:
		unsigned int m_ID;
		
		std::string m_Name;
		std::vector<Frame2D> m_Frames;		
		Animation2DType::TAnimation2DType m_Animation2DType;
		float m_TotalTime; // total time of the animation		
		float m_CurrentTime;
		int m_CurrentFrame;
		bool m_AnimationEnded;

#if EDITOR

	public:
		void Name(std::string val);
		void Animation2DType(TAnimation2DType val);
		void TotalTime(float val);
		void CurrentTime(float val);
		void CurrentFrame(int val);

	private:
		static const int m_Version; // load version

#endif
		
	};
} // namespace CasaEngine

#endif // _ANIMATION2D_H_
